package com.example.study1206.Config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

//@Configuration
//public class KafkaInitialConfiguration {
//
////    创建TopicName为topic.hangge.initial的Topic并设置分区数为8以及副本数为1
//    @Bean
//    public NewTopic initialTopic() {
//            return new NewTopic("topic.hangge.initial",8, (short) 1);
//    }
//}
@Configuration
public class InitialConfiguration {


    @Value("${redis.host}")
    private String host;

    @Value("${redis.port}")
    private int port;

    @Value("${redis.timeout}")
    private int timeout;

    @Bean
    public JedisPool jedisPoolFactory() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, "test");
        return jedisPool;
    }

}